$(function(){
	var map = new BMap.Map("allmap");
		map.centerAndZoom(new BMap.Point(116.526258,39.787381), 13);
		map.enableScrollWheelZoom();
		var str = "116.490326,39.751054;116.488601,39.758709;116.487595,39.77202;116.505454,39.770412;116.508113,39.776956;116.489679,39.786161;116.496039,39.789155;116.491476,39.792925;116.486086,39.795641;116.474444,39.803846;116.485188,39.816483;116.510663,39.826403;116.522593,39.81942;116.539122,39.826624;116.558956,39.802238;116.573329,39.811329;116.606674,39.781392;116.600494,39.780949;116.583534,39.776624;116.567867,39.776513;116.55795,39.771411;116.548464,39.766198;116.534954,39.749668;116.535097,39.749002;116.574982,39.735742;116.583031,39.713544;116.518066,39.707549";
	  var arr = str.split(";");
	  var d = [];
	  for(var i = 0;i<arr.length;i++){
	    var s = arr[i].split(',');
	  	d.push(new BMap.Point(s[0],s[1]));
	  }	
		var polygon = new BMap.Polygon(d, {strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5,strokeStyle:'dashed'});  //创建多边形
		polygon.addEventListener('click',function(){  
			polygon.setFillColor('');
			map.setZoom(14);
		})
		map.addOverlay(polygon);   //增加多边形
		map.addControl(new BMap.NavigationControl())
		var m = "116.541556,39.816075;116.527831,39.805554;116.524892,39.798621;116.500832,39.807415;116.511,39.809105;116.505319,39.797668;116.513162,39.801556;116.528296,39.785181;116.545572,39.777671;116.528657,39.770841;116.539465,39.791953;116.508017,39.762595";
	  var markers = m.split(";");
	  for(var i = 0;i < markers.length;i++){
	    var m = markers[i].split(',');
	  	var point = new BMap.Point(m[0],m[1]);
			var myIcon = new BMap.Icon("../img/map-icon.png", new BMap.Size(24,24));
			var marker = new BMap.Marker(point,{icon:myIcon}); 
			marker.addEventListener('click', function(){
				openLayer('jifang/jd_jifang_list.html','节点机房','1000px','500px');  
			})
				if(i == 3){
					marker.setAnimation(BMAP_ANIMATION_BOUNCE);
				}
			
	        map.addOverlay(marker);
					
	    }
})
